package com.omt.tarjimdinek.domain.tv.controller;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.context.annotation.Scope;

import com.omt.tarjimdinek.domain.tv.entity.Cheikh;
import com.omt.tarjimdinek.domain.tv.service.CheikhRepository;

/**
 * Simple pass over to access static 'cheikhUtil EL.
 * Keeps also the user's preferred locale.
 *
 * @see org.springframework.security.web.authentication.AnonymousAuthenticationFilter
 */
@Named("cheikhUtil")
@Scope("session")
public class CheikhController {

	private List<Cheikh> listeCheikh;
	
	@Inject
	private CheikhRepository cheikhRepository;
	
	public List<Cheikh> getAllCheikhs(){
		if(listeCheikh == null){
			listeCheikh = cheikhRepository.findAll();
		}
		return listeCheikh;
	}
	
	/**
	 * @return the cheikhRepository
	 */
	public CheikhRepository getCheikhRepository() {
		return cheikhRepository;
	}

	/**
	 * @param cheikhRepository the cheikhRepository to set
	 */
	public void setCheikhRepository(CheikhRepository cheikhRepository) {
		this.cheikhRepository = cheikhRepository;
	}
}
